import rxAjax from '@/assets/js/ajax.js';

//sys_excel api接口
export const ImportExcelApi = {};

ImportExcelApi.baseUrl= '/api-system/system/core/importExcel';
ImportExcelApi.exportUrl= ImportExcelApi.baseUrl + '/listExport';

ImportExcelApi.doImport=function(formData,callback) {
  var url= ImportExcelApi.baseUrl+"/doImport";
  return rxAjax.upload(url,formData,callback);
}

ImportExcelApi.executeImport=function(formData,callback) {
  var url = ImportExcelApi.baseUrl + "/executeImport";
  return rxAjax.upload(url, formData, callback);
}


//查询列表
ImportExcelApi.query=function (parameter) {
  var url= ImportExcelApi.baseUrl + '/query';
  return rxAjax.postJson(url,parameter).then (res => {
    return res.result
  })
}

/**
 * 获取单记录
 * @param pkId
 * @returns {*}
 */
ImportExcelApi.get =function(pkId) {
  var url= ImportExcelApi.baseUrl + '/get?pkId=' + pkId;
  return rxAjax.get(url);
}

//保存数据
ImportExcelApi.save =function(parameter) {
  var url= ImportExcelApi.baseUrl + '/save';
  return rxAjax.postJson(url,parameter);
}

//删除数据
ImportExcelApi.del =function(parameter) {
  var url= ImportExcelApi.baseUrl + '/del';
  return rxAjax.postUrl(url,parameter);
}

export  default ImportExcelApi;

